From 6cb06bacf10675ae01386fd37a0c7edcee647eda Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 20 Jul 2007 10:38:51 +0100 Subject: [PATCH] Xen PM: Enter all ACPI S states on boot CPU. Signed-off-by: Kevin Tian Signed-off-by: Keir Fraser --- xen/arch/x86/acpi/power.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 69a2f1febf..3435955cd2 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -124,7 +124,7 @@ static int enter_state(u32 state) if ( !spin_trylock(&pm_lock) ) return -EBUSY; - + pmprintk(XENLOG_INFO, "PM: Preparing system for %s sleep\n", acpi_states[state]); @@ -153,12 +153,15 @@ static int enter_state(u32 state) switch ( state ) { - case ACPI_STATE_S3: - do_suspend_lowlevel(); - break; - default: - error = -EINVAL; - break; + case ACPI_STATE_S3: + do_suspend_lowlevel(); + break; + case ACPI_STATE_S5: + acpi_enter_sleep_state(ACPI_STATE_S5); + break; + default: + error = -EINVAL; + break; } pmprintk(XENLOG_INFO, "Back to C!\n"); @@ -183,14 +186,6 @@ static int enter_state(u32 state) return error; } -static void acpi_power_off(void) -{ - pmprintk(XENLOG_INFO, "%s called\n", __FUNCTION__); - local_irq_disable(); - /* Some SMP machines only can poweroff in boot CPU */ - acpi_enter_sleep_state(ACPI_STATE_S5); -} - static long enter_state_helper(void *data) { struct acpi_sleep_info *sinfo = (struct acpi_sleep_info *)data; @@ -227,7 +222,7 @@ int acpi_enter_sleep(struct xenpf_enter_acpi_sleep *sleep) if ( !(sleep->pm1a_cnt_val & ACPI_BITMASK_SLEEP_ENABLE) ) { outw((u16)sleep->pm1a_cnt_val, acpi_sinfo.pm1a_cnt); - if (acpi_sinfo.pm1b_cnt) + if ( acpi_sinfo.pm1b_cnt ) outw((u16)sleep->pm1b_cnt_val, acpi_sinfo.pm1b_cnt); return 0; } @@ -237,13 +232,6 @@ int acpi_enter_sleep(struct xenpf_enter_acpi_sleep *sleep) acpi_sinfo.pm1b_cnt_val = sleep->pm1b_cnt_val; acpi_sinfo.sleep_state = sleep->sleep_state; - /* ACPI power-off method. */ - if ( acpi_sinfo.sleep_state == ACPI_STATE_S5 ) - { - for ( ; ; ) - acpi_power_off(); - } - return continue_hypercall_on_cpu(0, enter_state_helper, &acpi_sinfo); } -- 2.30.2